<template>
	<view>
		<view class="fff_box">
			<view class="row_item b-b-ea">
				<view class="lable">
					支付宝姓名：
				</view>
				<view class="value">
					<input v-model="FormData.alipay_name" type="text" placeholder="请输入真实姓名"/>
				</view>
			</view>
			<view class="row_item">
				<view class="lable">
					支付宝账号：
				</view>
				<view class="value">
					<input v-model="FormData.alipay_account" type="text" placeholder="请输入手机号码"/>
				</view>
			</view>
		</view>
		<view class="fff_box">
			<view class="row_item b-b-ea">
				<view class="lable">
					开户行名称：
				</view>
				<view class="value">
					<input v-model="FormData.bank_name" type="text" placeholder="请输入开户行名称"/>
				</view>
			</view>
			<view class="row_item b-b-ea">
				<view class="lable">
					开户行户名：
				</view>
				<view class="value">
					<input v-model="FormData.bank_account" type="text" placeholder="请输入开户行户名"/>
				</view>
			</view>
			<view class="row_item">
				<view class="lable">
					银行卡号：
				</view>
				<view class="value">
					<input v-model="FormData.bank_card" type="text" placeholder="请输入银行卡号"/>
				</view>
			</view>
		</view>
		<view class="bottom-fixed">
			<view class="btn_box">
				<button class="btn" @click="confirm">保存</button>
			</view>
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				FormData:{
					alipay_name:'',
					alipay_account:'',
					bank_name:'',
					bank_account:'',
					bank_card:'',
				}
			}
		},
		onLoad() {
			this.getData()
		},
		methods: {
			getData(){
				let self = this
				self._get('store.order/config', self.FormData, function(res) {
					if(res.code==1){
						self.FormData.alipay_name = res.data.model.alipay_name
						self.FormData.alipay_account = res.data.model.alipay_account
						self.FormData.bank_name = res.data.model.bank_name
						self.FormData.bank_account = res.data.model.bank_account
						self.FormData.bank_card = res.data.model.bank_card
					}
				});
			},
			confirm(){
				let self = this
				if (!this.FormData.alipay_name) {
					uni.showToast({
						icon: 'none',
						title: '请输入真实姓名'
					})
					return
				}
				if (!this.FormData.alipay_account) {
					uni.showToast({
						icon: 'none',
						title: '请输入手机号码'
					})
					return
				}
				if (!this.FormData.bank_name) {
					uni.showToast({
						icon: 'none',
						title: '请输入开户行名称'
					})
					return
				}
				if (!this.FormData.bank_account) {
					uni.showToast({
						icon: 'none',
						title: '请输入开户行户名'
					})
					return
				}
				if (!this.FormData.bank_card) {
					uni.showToast({
						icon: 'none',
						title: '请输入银行卡号'
					})
					return
				}
				self._post('store.order/config', self.FormData, function(res) {
					if(res.code==1){
						uni.showToast({
							title: '设置成功',
							duration: 2000,
							icon: 'success'
						});
						uni.navigateBack();
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.bottom-fixed{
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9;
		padding-bottom: env(safe-area-inset-bottom);
		background-color: #fff;
		.btn_box{
			width: 700rpx;
			margin: 20rpx auto;
			.btn{
				width: 700rpx;
				height: 88rpx;
				line-height: 88rpx;
				background-color: #1BAE61;
				color: #fff;
				border-radius: 16rpx;
				font-size: 32rpx;
			}
		}
	}
	.b-b-ea{
		border-bottom: 1rpx solid #eaeaea;
	}
	.fff_box{
		width: 700rpx;
		margin: 20rpx auto;
		background-color: #fff;
		border-radius: 16rpx;
		padding: 20rpx;
		box-sizing: border-box;
		.row_item{
			display: flex;
			align-items: center;
			.lable{
				width: 200rpx;
				height: 88rpx;
				line-height: 88rpx;
				font-size: 28rpx;
			}
			.value{
				flex: 1;
				input{
					width: 100%;
					height: 88rpx;
					line-height: 88rpx;
					font-size: 28rpx;
				}
			}
		}
	}
</style>
